package com.qf.controller;

import com.qf.pojo.TSetmeal;
import com.qf.service.TCheckgroupService;
import com.qf.service.TSetmealService;
import com.qf.utils.Result;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequiredArgsConstructor
public class SetmealController {
    private final TSetmealService setmealService;
    private final TCheckgroupService checkgroupService;
    @GetMapping("/setmeal/findPage")
    public Result listSetmealPage(@RequestParam(value = "currentPage",defaultValue = "1") int page,
                                  @RequestParam(value = "pageSize") int pageSize,
                                  @RequestParam(value = "queryString",defaultValue = "") String queryString){
        return setmealService.listSetmealPage(page,pageSize,queryString);
    }

    @GetMapping("/checkgroup/findAll")
    public Result findAllCheckgroup(){
        return checkgroupService.findAllCheckgroup();
    }
    @PostMapping("/setmeal/add")
    public void add(@RequestParam("checkgroupIds") List<String> checkgroupIds, @RequestBody TSetmeal setmeal){
        setmealService.add(checkgroupIds,setmeal);
        //Todo  没写完添加套餐
    }
}
